package com.screens;

import sheep.game.Sprite;
import sheep.game.State;
import sheep.graphics.Image;
import sheep.gui.TextButton;
import sheep.gui.WidgetAction;
import sheep.gui.WidgetListener;
import android.graphics.Canvas;

import com.bricks2break.R;
import com.bricks2break.Statics;

/**
 * New screen for Brick properties, to show the different kinds of bricks.
 * 
 *
 */

public class BrickProperties extends State implements WidgetListener{
	/**
	 * Creates the objects.
	 */
		private TextButton backButton;
		private TextButton headLineTxt;
		private TextButton brickTxt;
		private TextButton brickTxt2;
		private TextButton dSpeedTxt;
		private TextButton dSpeedTxt2;
		private TextButton dPointsTxt;
		private TextButton dPointsTxt2;
		
		/**
		 * Instantiates the objects.
		 * 
		 */
		public BrickProperties(){
			backButton = new TextButton(Statics.SCREEN_WIDTH*0.1f,Statics.SCREEN_HEIGHT*0.8f,Statics.string_back);
			headLineTxt = new TextButton(Statics.SCREEN_WIDTH*0.1f, Statics.SCREEN_HEIGHT*0.1f,Statics.string_brick_properties);
			brickTxt = new TextButton(Statics.SCREEN_WIDTH*0.1f, Statics.SCREEN_HEIGHT*0.32f,Statics.string_normal_brick);
			brickTxt2 = new TextButton(Statics.SCREEN_WIDTH*0.1f, Statics.SCREEN_HEIGHT*0.35f,Statics.string_normal_brick_properties);
			dSpeedTxt = new TextButton(Statics.SCREEN_WIDTH*0.1f, Statics.SCREEN_HEIGHT*0.47f,Statics.string_double_speed_brick);
			dSpeedTxt2 = new TextButton(Statics.SCREEN_WIDTH*0.1f, Statics.SCREEN_HEIGHT*0.50f,Statics.string_double_speed_brick_properties);
			dPointsTxt = new TextButton(Statics.SCREEN_WIDTH*0.1f, Statics.SCREEN_HEIGHT*0.62f,Statics.string_double_points_brick);
			dPointsTxt2 = new TextButton(Statics.SCREEN_WIDTH*0.1f, Statics.SCREEN_HEIGHT*0.67f,Statics.string_double_points_brick_properties);
			
			addTouchListener(backButton);
			
			backButton.addWidgetListener(this);
			
		}
		
		/**
		 * Defines what the buttons do.
		 */
		public void actionPerformed(WidgetAction action) {
			if(action.getSource() == backButton){
				getGame().popState();
			}
		}
		
		/**
		 * Draws the objects.
		 */
		public void draw(Canvas canvas){
			super.draw(canvas);
			canvas.drawRect(0, 0, Statics.SCREEN_WIDTH, Statics.SCREEN_HEIGHT, Statics.black);			
			headLineTxt.draw(canvas);
			
			canvas.drawRect(Statics.SCREEN_WIDTH*0.1f,Statics.SCREEN_HEIGHT*0.25f,Statics.SCREEN_WIDTH*0.1f+Statics.image_brick.getWidth(),Statics.SCREEN_HEIGHT*0.25f+Statics.image_brick.getHeight(),Statics.white);
			brickTxt.draw(canvas);
			brickTxt2.draw(canvas);
			
			canvas.drawRect(Statics.SCREEN_WIDTH*0.1f,Statics.SCREEN_HEIGHT*0.40f,Statics.SCREEN_WIDTH*0.1f+Statics.image_brick.getWidth(),Statics.SCREEN_HEIGHT*0.40f+Statics.image_brick.getHeight(),Statics.green);
			canvas.drawText("2x speed", Statics.SCREEN_WIDTH*0.1f+10, Statics.SCREEN_HEIGHT*0.40f+Statics.image_brick.getHeight()/2+10, Statics.black);
			dSpeedTxt.draw(canvas);
			dSpeedTxt2.draw(canvas);
			
			canvas.drawRect(Statics.SCREEN_WIDTH*0.1f,Statics.SCREEN_HEIGHT*0.55f,Statics.SCREEN_WIDTH*0.1f+Statics.image_brick.getWidth(),Statics.SCREEN_HEIGHT*0.55f+Statics.image_brick.getHeight(),Statics.orange);
			canvas.drawText("2x points", Statics.SCREEN_WIDTH*0.1f+10, Statics.SCREEN_HEIGHT*0.55f+Statics.image_brick.getHeight()/2+10, Statics.black);
			dPointsTxt.draw(canvas);
			dPointsTxt2.draw(canvas);
			
			backButton.draw(canvas);
		}
}
